package algorithm.leetcode;

import algorithm.templates.TreeNode;

import java.util.ArrayList;
import java.util.List;

public class NO94_二叉树的中序遍历 {
    public static void main(String[] args) {

    }

    static class Solution {
        public List<Integer> inorderTraversal(TreeNode root) {
            List<Integer> result = new ArrayList<>();
            inorderTreeTravel(result, root);
            return result;
        }

        private void inorderTreeTravel(List<Integer> result, TreeNode root) {
            if (root != null) {
                inorderTreeTravel(result, root.left);
                result.add(root.val);
                inorderTreeTravel(result, root.right);
            }
        }
    }

}
